package d2_com.itheima.io;

import java.io.*;

/**
 * 字符缓冲流
 */
public class Test5 {
    public static void main(String[] args) {
        /**
         * 字符缓冲输入流 和 字符缓冲输出流
         */
        try (
               /* //简便写法
                BufferedReader fos = new BufferedReader(new FileReader("oop-app6\\7.txt"));*/
                Reader fo = new FileReader("oop-app6\\7.txt");
                ///1、定义一个字节缓冲输入流包装原始的字节输入流
                BufferedReader fos = new BufferedReader(fo);
               /* //简便写法
                BufferedWriter fis = new BufferedWriter(new FileWriter("oop-app6\\8.txt"));*/
                Writer fi = new FileWriter("oop-app6\\8.txt");
                //2、定义一个字节缓冲输出流包装原始的字节输出流
                BufferedWriter fis = new BufferedWriter(fi)
        ) {
            String line;
            while ((line = fos.readLine()) != null) {
                fis.write(line);
                fis.newLine();//写入换行
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
